import Base from 'models/base';

import moment from 'moment';
import SystemUtil from 'utils/systemUtil';

export default class ShopEvaluate extends Base {
  constructor(evaluate) {
    super();

    let pic = evaluate.appraisePic;
    let picList;
    if (SystemUtil.isEmpty(pic)) {
      picList = [];
    } else {
      picList = JSON.parse(pic);
    }
    this.picList = picList;

    let score = evaluate.appraiseScore;
    this.score = score;
    score = Math.floor(score);
    this.star = score / 2;

    let createTime = evaluate.createTime;
    this.time = moment(createTime).valueOf();

    this.id = SystemUtil.getId();
    this.text = evaluate.appraiseMsg;
    this.headimgurl = evaluate.headimgurl;
    this.nickname = evaluate.nickname;
  }
}
